<?php
switch ($csn){
	case "12" :	//list RT / PCR / qPCR
	case "13" : //list transfection Reagent
	case "14" : //list Viral Expression
	case "15" : // list Cell Immortalization
	case "16" : // list siRNA
		$sql="select * from category where sn = '$csn'";
		$res=mysql_query($sql,$db);
		$rw=mysql_num_rows($res);
		echo "<ul>";
		if ($rw>0){
			while ($r=mysql_fetch_array($res)){
				echo "<li>&nbsp;".$r['cname']."</li>";
				$csn = $r['sn'];
				$ssql="select * from subcat where csn='".$r['sn']."'";
				$sres=mysql_query($ssql,$db);
				$srw=mysql_num_rows($sres);
				echo "<ul>";
				if ($srw>0){
					while ($sr=mysql_fetch_array($sres)){
						$ssn = $sr['sn'];
						if ($csn <> '13' and $csn <>'15' and $csn <> '16'){
							echo "<li>&nbsp;".$sr['sname']."&nbsp;<img src='images/arrow-down.png' width='9' height='6' /></li>";
						}
						//display sub menus.
						$submnu = "select * from chdcat where csn='$csn' and ssn='$ssn'";
						$submnu_res = mysql_query($submnu,$db);
						$submnu_rows = mysql_num_rows($submnu_res);
						echo "<ul>";
						if ($submnu_rows > 0){
							while ($submnu_r = mysql_fetch_array($submnu_res)){
								$submnu_name = $submnu_r['dname'];
								$dsn = $submnu_r['sn'];
								if ($csn == '14' && $ssn =='3883' && $dsn =='4019'){// ignore Hybrid Expression Systems
									continue;
								}else{
									echo "<li><a href='../moreproduct/ProdList.php?csn=$csn&ssn=$ssn&dsn=$dsn'>&nbsp;&nbsp;&#8226;&nbsp;$submnu_name</a></li>";
								}
							}
						}
						echo "</ul>";
					}
				}
				echo "</ul>";
			}
		}
		echo "</ul>";
		break;
	
	
	case "17" : // list Tag Antibody from database userdb_35872_1
	case "18" :
		mysql_close($db);
		include ("../includes/connabm.php");
		if ($csn == '17'){
			$sql="select * from progrp where sn='2'";
		}else{
			$sql="select * from progrp where sn='12'";
		}
		$res=mysql_query($sql,$db);
		$rw=mysql_num_rows($res);
		echo "<ul>";
		if ($rw>0){
			$r=mysql_fetch_array($res);
			echo "<li>&nbsp;".$r['gname']."</li>";
			$grpno = $r['sn'];
			$ssn = $r['sn'];
			$ssql="select * from subgrp where grpno='".$r['sn']."'";
			$sres=mysql_query($ssql,$db);
			$srw=mysql_num_rows($sres);
			echo "<ul>";
			echo "<ul>";
			if ($srw>0){
				while ($sr=mysql_fetch_array($sres)){
					$subno = $sr['sn'];
					$dsn = $sr['sn'];
					$subname = $sr['subname'];
					//display sub menus.
					if ($csn == '17'){
						echo "<li><a href='../TagAntibody/dispList.php?csn=$grpno&amp;ssn=$subno&amp;catno=$catno'>&nbsp;&nbsp;&#8226;&nbsp;$subname</a></li>";
					}else{
						echo "<li><a href='../LoadingControl/dispList.php?csn=$grpno&amp;ssn=$subno&amp;catno=$catno'>&nbsp;&nbsp;&#8226;&nbsp;$subname</a></li>";
					}
				}
			}
			echo "</ul>";
			echo "</ul>";
		}
		echo "</ul>";
		mysql_close($db);
		include ("../includes/conn.php");
		break;
	
	case "19" :	//list Secondary Antibody
	case "20" : //list DNA Purification
	case "21" : //list Western Blot
	case "22" : // list DNA Marker and Chemicals
	case "23" : // list Cell Lysates
	case "24" : // list Sample Preparation
	case "25" : // list Custom Services
	case "26" : // list miRNA
	case "29" : // list Immortalized Primary Cells
	case "40" : // list Protein
	
		$sql="select * from category where sn = '$csn'";
		$res=mysql_query($sql,$db);
		$rw=mysql_num_rows($res);
		echo "<ul>";
		if ($rw>0){
			while ($r=mysql_fetch_array($res)){
				echo "<li>&nbsp;".$r['cname']."</li>";
				$csn = $r['sn'];
				$ssql="select * from subcat where csn='".$r['sn']."'";
				$sres=mysql_query($ssql,$db);
				$srw=mysql_num_rows($sres);
				echo "<ul>";
				if ($srw>0){
					while ($sr=mysql_fetch_array($sres)){
						$ssn = $sr['sn'];
						if ($csn <> '20' and $csn <>'21' and $csn <> '22' and $csn <> '23' and $csn <> '24' and $csn <> '25'){
							echo "<li>&nbsp;".$sr['sname']."&nbsp;<img src='images/arrow-down.png' width='9' height='6' /></li>";
						}
						//display sub menus.
						$submnu = "select * from chdcat where csn='$csn' and ssn='$ssn'";
						$submnu_res = mysql_query($submnu,$db);
						$submnu_rows = mysql_num_rows($submnu_res);
						echo "<ul>";
						if ($submnu_rows > 0){
							while ($submnu_r = mysql_fetch_array($submnu_res)){
								$submnu_name = $submnu_r['dname'];
								$dsn = $submnu_r['sn'];
								echo "<li><a href='../moreproduct/ProdList.php?csn=$csn&ssn=$ssn&dsn=$dsn'>&nbsp;&nbsp;&#8226;&nbsp;$submnu_name</a></li>";
							}
						}
						echo "</ul>";
					}
				}
				echo "</ul>";
			}
		}
		echo "</ul>";
		break;
	
	
	case "30"://list Stem Cells
		$sql="select * from category where sn='$csn'";
		$res=mysql_query($sql,$db);
		$rw=mysql_num_rows($res);
		echo "<ul>";
		if ($rw>0){
			while ($r=mysql_fetch_array($res)){
				echo "<li>&nbsp;".$r['cname']."</li>";
				$csn = $r['sn'];
				$ssql="select * from subcat where csn='".$r['sn']."'";
				$sres=mysql_query($ssql,$db);
				$srw=mysql_num_rows($sres);
				echo "<ul>";
				if ($srw>0){
					while ($sr=mysql_fetch_array($sres)){
						$ssn = $sr['sn'];
						if ($ssn == '6640' || $ssn == '6641' || $ssn == '11352'){
							continue;
						}
						echo "<li>&nbsp;".$sr['sname']."&nbsp;<img src='images/arrow-down.png' width='9' height='6' /></li>";
						//display sub menus.
						$submnu = "select * from chdcat where csn='$csn' and ssn='$ssn'";
						$submnu_res = mysql_query($submnu,$db);
						$submnu_rows = mysql_num_rows($submnu_res);
						echo "<ul>";
						if ($submnu_rows > 0){
							while ($submnu_r = mysql_fetch_array($submnu_res)){
								$submnu_name = $submnu_r['dname'];
								$dsn = $submnu_r['sn'];
								switch ($submnu_name) {
									case "iPSC Recombinant Proteins":
										echo "<li><a href='IPSC-RP.php?csn=30&amp;ssn=11344&amp;dsn=$dsn'>&nbsp;&nbsp;&#8226;&nbsp;$submnu_name</a></li>";
										break;
									case "iPSC Lentiviruses":
										echo "<li><a href='IPSC-L.php?csn=30&amp;ssn=11344&amp;dsn=$dsn'>&nbsp;&nbsp;&#8226;&nbsp;$submnu_name</a></li>";
										break;
									case "iPSC Adenoviruses":
										echo "<li><a href='IPSC-A.php?csn=30&amp;ssn=11344&amp;dsn=$dsn'>&nbsp;&nbsp;&#8226;&nbsp;$submnu_name</a></li>";
										break;
									case "iPSC-based Plasmids":
										echo "<li><a href='IPSC-Plasmids.php?csn=30&amp;ssn=11344&amp;dsn=$dsn'>&nbsp;&nbsp;&#8226;&nbsp;$submnu_name</a></li>";
										break;
										
										
									case "iPSC Antibodies":
										echo "<li><a href='IPSC-Anti.php?csn=30&amp;ssn=11348&amp;dsn=$dsn'>&nbsp;&nbsp;&#8226;&nbsp;$submnu_name</a></li>";
										break;
									case "Stem Cell Antibodies":
										echo "<li><a href='SC-Anti.php?csn=30&amp;ssn=11348&amp;dsn=$dsn'>&nbsp;&nbsp;&#8226;&nbsp;$submnu_name</a></li>";
										break;
										
										
									case "Primary Cells":
										echo "<li><a href='PrimaryCells.php?csn=30&amp;ssn=11349&amp;dsn=$dsn'>&nbsp;&nbsp;&#8226;&nbsp;$submnu_name</a></li>";
										break;
									case "Embryonic Stem Cells":
										echo "<li><a href='Em-StemCells.php?csn=30&amp;ssn=11349&amp;dsn=$dsn'>&nbsp;&nbsp;&#8226;&nbsp;$submnu_name</a></li>";
										break;
									case "iPSCs":
										echo "<li><a href='IPSC-StemCells.php?csn=30&amp;ssn=11349&amp;dsn=$dsn'>&nbsp;&nbsp;&#8226;&nbsp;$submnu_name</a></li>";
										break;
									case "Feeder Cells":
										echo "<li><a href='FeederCells.php?csn=30&amp;ssn=11349&amp;dsn=$dsn'>&nbsp;&nbsp;&#8226;&nbsp;$submnu_name</a></li>";
										break;
										
										
									case "iPSC Stem Cells":
										echo "<li><a href='IPSC-StemCells.php?csn=30&amp;ssn=11349&amp;dsn=$dsn'>&nbsp;&nbsp;&#8226;&nbsp;$submnu_name</a></li>";
										break;
									case "Multipluripontent Cells":
										echo "<li><a href='Multi-Cells.php?csn=30&amp;ssn=11349&amp;dsn=$dsn'>&nbsp;&nbsp;&#8226;&nbsp;$submnu_name</a></li>";
										break;
										
										
									case "Small Molecules":
										echo "<li><a href='Small-Molecu.php?csn=30&amp;ssn=11347&amp;dsn=$dsn'>&nbsp;&nbsp;&#8226;&nbsp;$submnu_name</a></li>";
										break;
									case "Growth Factors":
										echo "<li><a href='Gr-Factors.php?csn=30&amp;ssn=11347&amp;dsn=$dsn'>&nbsp;&nbsp;&#8226;&nbsp;$submnu_name</a></li>";
										break;
										
										
									case "Characterization Kits":
										echo "<li><a href='Char-Kits.php?csn=30&amp;ssn=11345&amp;dsn=$dsn'>&nbsp;&nbsp;&#8226;&nbsp;$submnu_name</a></li>";
										break;
									case "Stemporter (Stem gene promoter reporters)":
										echo "<li><a href='Stemporter.php?csn=30&amp;ssn=11345&amp;dsn=$dsn'>&nbsp;&nbsp;&#8226;&nbsp;$submnu_name</a></li>";
										break;
										
										
									case "Medium":
										echo "<li><a href='Medium.php?csn=30&amp;ssn=11346&amp;dsn=$dsn'>&nbsp;&nbsp;&#8226;&nbsp;$submnu_name</a></li>";
										break;
									case "Culture Products":
										echo "<li><a href='Cul-Prod.php?csn=30&amp;ssn=11346&amp;dsn=$dsn'>&nbsp;&nbsp;&#8226;&nbsp;$submnu_name</a></li>";
										break;
								}
							}
						}
						echo "</ul>";
					}
				}
				echo "</ul>";
			}
		}
		echo "</ul>";
		break;
}


// RT/PCR/qPCR; Transfection Reagents; ......
for ($i=12;$i<17;$i++){
	if ($i == $csn){
		continue;
	}else{
		$sql="select * from category where sn = '$i'";
		$res=mysql_query($sql,$db);
		$rw=mysql_num_rows($res);
		echo "<ul>";
		if ($rw>0){
			while ($r=mysql_fetch_array($res)){
				echo "<li><a href='?csn=$i&amp;catno=$catno'>&nbsp;<span>&raquo;</span> ".$r['cname']."</a></li>";
			}
		}
		echo "</ul>";
	}
}
		

// Tag Antibodies
if ($csn <> 17){
	$sql="select * from category where sn='17'";
	$res=mysql_query($sql,$db);
	$rw=mysql_num_rows($res);
	echo "<ul>";
	if ($rw>0){
		$r=mysql_fetch_array($res);
		echo "<li><a href='?csn=17&amp;catno=$catno'>&nbsp;<span>&raquo;</span> ".$r['cname']."</a></li>";
	}
	echo "</ul>";
}


// Loading Control
if ($csn <> 18){
	$sql="select * from category where sn=18";
	$res=mysql_query($sql,$db);
	$rw=mysql_num_rows($res);
	echo "<ul>";
	if ($rw>0){
		$r=mysql_fetch_array($res);
		echo "<li><a href='?csn=18&amp;catno=$catno'>&nbsp;<span>&raquo;</span> ".$r['cname']."</a></li>";
	}
	echo "</ul>";
}


//display others
for ($i=19;$i<31;$i++){
	if ($i == $csn){
		continue;
	}else{
		$sql="select * from category where sn = '$i'";
		$res=mysql_query($sql,$db);
		$rw=mysql_num_rows($res);
		echo "<ul>";
		if ($rw>0){
			while ($r=mysql_fetch_array($res)){
				echo "<li><a href='?csn=$i&amp;catno=$catno'>&nbsp;<span>&raquo;</span> ".$r['cname']."</a></li>";
			}
		}
		echo "</ul>";
	}
}
?>